package cn.tedu.spring.di;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

/**
 * @Author Justin Parker
 * @Date 2024/8/2 0002 14:27
 * @Version 1.0
 */
@Service
public class UserService {
    @Value("彩虹屁")
    private String serviceName;
    /**
     * @Autowired注解：自动装配注解，注入的是对象类型或者接口类型的数据；
     * 添加位置：
     * 1.属性上【后期在工程中经常添加在属性上】
     * 2.set方法上；
     * 3.构造方法上；
     */
//    @Autowired
    private UserDao userDao;
//    @Autowired
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }
    @Autowired
    public UserService(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public String toString() {
        return "UserService{" +
                "serviceName='" + serviceName + '\'' +
                ", userDao=" + userDao +
                '}';
    }
}
